package com.jiajia.study.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Title: RabbitConfirmConfig
 * @Author zjj
 * @Package com.jiajia.study.config
 * @Date 2024/3/14 9:51
 * @description:    confirm 模式的配置
 */

@Configuration
public class RabbitConfirmConfig {

    @Bean
    public DirectExchange directExchange(){
        return ExchangeBuilder.directExchange("confirm.exchange").build();
    }

    @Bean
    public Queue queue(){
        return QueueBuilder.durable("confirm.queue").build();
    }

    @Bean
    public Binding binding(DirectExchange directExchange,Queue queue){
        return BindingBuilder.bind(queue).to(directExchange).with("confirm");
    }

}
